<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>如何禁止鼠标右键，显示上下文菜单，赋值此内容</div>
    <script>
        document.addEventListener('contextmenu',function(event) {
            //阻止事件的默认行为
            event.preventDefault();
        });

        document.addEventListener('selectstart',function(event) {
            // 阻止事件的默认行文
            event.preventDefault();
        });
    </script>
</body>
</html>